package com.apes.auto.car.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.util.DateUtil;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * @ClassName CarPartElectronicCatalogue
 * @Description 车型配件电子目录
 * @Author pengyb
 * @Date 2019/8/2 11:31
 * @Version 1.0
 **/
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = CarPartElectronicCatalogue.CONST_TABLE_NAME)
@IdClass(PartsIdClass.class)
public class CarPartElectronicCatalogue {
    public static final String CONST_TABLE_NAME = "MAS_CXPJDZML";
    @Id
    @Column(name = "PZCXID", length = 32)
    @Comment("车型ID")
    private String pzcxid;

    @Column(name = "PLID", length = 16)
    @Comment("品类编码")
    private String plid;

    @Column(name = "PLMC", length = 128)
    @Comment("品类名称")
    private String plmc;

    @Id
    @Column(name = "PJMCID", length = 16)
    @Comment("配件名称编码")
    private String pjmcid;

    @Column(name = "PJMC", length = 128)
    @Comment("配件名称")
    private String pjmc;

    @Column(name = "PJYL", columnDefinition = "number(16,1) default 1")
    @Comment("配件用量")
    private int pjyl;

    @Column(name = "LJID", length = 4000)
    @Comment("零件编码")
    private String ljid;


    @Column(name = "OEID", length = 4000)
    @Comment("OEM码")
    private String oeid;


    @Column(name = "TS01", length = 36)
    @Comment("时间戳")
    private String ts01;


    @Column(name = "LRR", length = 64)
    @Comment("录入人")
    private String lrr;

    @JSONField(format = DateUtil.SHOW_DATE_FORMAT)
    @Temporal(TemporalType.DATE)
    @Column(name = "LRRQ_SJ")
    private Date lrrq_sj; //录入日期

    @Column(name = "ID2", length = 16)
    @Comment("停用的车型配件代码")
    private String id2;

    @Column(name = "RZCS")
    @Comment("认证次数")
    private int rzcs;

    @Column(name = "ZXYLDW", length = 64)
    @Comment("最小用量单位")
    private String zxyldw;

    @Column(name = "CKJ_4S", length = 64)
    @Comment("4S售价")
    private String ckj_4s;

    @Column(name = "COST_4S", length = 64)
    @Comment("4S进价")
    private String cost_4s;

    @Column(name = "XSZDJ", length = 64)
    @Comment("销售指导价")
    private String xszdj;
}
